//
//  SKTabBarButton.m
//  loveKangaroo
//
//  Created by SeeKool on 15/3/3.
//  Copyright (c) 2015年 SeeKool Inc. All rights reserved.
//

#import "SKTabBarButton.h"

@implementation SKTabBarButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //1.设置图片居中
        self.imageView.contentMode = UIViewContentModeCenter;
        //2.设置标题居中
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        //3.设置标题文字大小
        self.titleLabel.font = [UIFont systemFontOfSize:13];
        //4.设置标题文字颜色
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
        
    }
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect{
    
    return CGRectMake(0, 0, self.width, self.height);
}
- (void)setItem:(UITabBarItem *)item{
    _item = item;
    //1.设置按钮默认状态的图片
    [self setImage:item.image forState:UIControlStateNormal];
    //2.设置按钮选中状态的图片
    [self setImage:item.selectedImage forState:UIControlStateSelected];
    //3.设置按钮的标题
    [self setTitle:item.title forState:UIControlStateNormal];
    
}

/**
 *  取消高亮状态
 */
- (void)setHighlighted:(BOOL)highlighted{
    
}

@end
